<template>
	<view>
		<view style="width: 100%;position: relative;height: 100vh;">
			<image class="image" style="width: 100%;height: 100vh;" :src="data.bg_image" mode=""></image>
			<view style="position: absolute;bottom: 600rpx;left: 0;right: 0;">
				<text style="color: #fff;margin: 20rpx 80rpx;display: block;">请输入四位数字验证码</text>
				<fui-single-input isFocus  border="1" type="number" activeColor="#fff" background="#fff" @complete="onComplete"></fui-single-input>
			</view>
		</view>
	</view>
</template>

<script>
	var app = getApp();
	import fuiSingleInput from "@/pagesZ/fui-single-input/fui-single-input.vue"
	export default {
		components: {
			fuiSingleInput
		},
		data() {
			return {
				data: {},
				code:''
			}
		},
		onLoad(opt) {
			const scene = decodeURIComponent(opt.scene)
			const code = scene.split('=')
			console.log(code[1],'opt')
			this.code = code[1]
			this.get()
		},
		methods: {
			onComplete(e){
				let _this = this
				app.post('ApiMy/check_qrcode_coupon_code', {
					show_code: e.detail.value,
					code: _this.code
				}, function(data) {
					if (data.data.can == 1) {
						uni.redirectTo({
							url:`/pagesZ/turntable/turntable?show_code=${e.detail.value}&code=${_this.code}`
						})
					} else {
						uni.showToast({
							title: data.msg,
							icon: 'none'
						})
					}
				})
			},
			get() {
				let _this = this
				app.get('ApiMy/get_qrcode_coupon_info', {
					aid: 64
				}, function(data) {
					if (data.status != 1) {
						uni.showToast({
							title: data.msg,
							icon: 'none'
						})
					} else {
						_this.data = data.data
					}
				})
			}
		}
	}
</script>

<style>

</style>